<?php
if (is_object($GLOBALS['enterprise']['cdba']))
{
  $ecats = $GLOBALS['enterprise']['cdba']->getPub();

  if (!($GLOBALS['enterprise']['subject'] = $env->param('subject')))
  {
    $i = 0;
    while ($ecats[$i]['teiler']=='Y')
      $i++;
    $GLOBALS['enterprise']['subject'] = $ecats[$i]['name'];
  }

  $doc = $docs->getByName('handwerkerdb');
  $script_name = $tpl->prepareLink('pageid:'.$doc[0]['id']);
  if (strpos($script_name,'?')===false)
    $script_name .= '?';
  else
    $script_name .= '&';
    
?>
<table border="0" cellspacing="0" cellpadding="3" width="100%">
<?php
  for ($i=0;$i<count($ecats);$i++) {
    if ($ecats[$i]['teiler']=='Y')
    {
  ?><tr><td class="sidenav2nd" align="left">
  <span style="color:#ffe400">&gt;&gt;</span> <?=$ecats[$i]['name']?> <span style="color:#ffe400">&lt;&lt;</span></td></tr>
   <?php
    }
    else
    {
  ?><tr><td class="sidenav2nd" align="left">
  <?php 
  if ($ecats[$i]['name']==$GLOBALS['enterprise']['subject'] && $doc_id == $doc[0]['id'])
    echo "<span style=\"color:#ffe400\">&gt;</span>";
  else
    echo "&gt;";
  ?><a class="sidenav" href="<?php echo $script_name ?>subject=<?php echo urlencode($ecats[$i]['name']) ?>" class="mainnav">
  <?=$ecats[$i]['name']?></a></td></tr>
   <?php
    }

}

?>
</table>
<?php 
}
else 
{
  print "<b>Warnung:</b> binden Sie die Kopfapplikation ein!";
}
?>
